
 
 F u n c t i o n :   l o a d ( s t r i n g P a t h ,   d o m I n s e r t i o n E l e m e n t ,   o b j e c t D a t a ,   f u n c t i o n S u c c e s s ( d o m E l e m e n t T o I n s e r t ,   p r o m i s e O b j e c t ) ,   f u n c t i o n E r r o r ( e r r o r M e s s a g e ,   p r o m i s e O b j e c t ) ) 
 
 
 
 D e s c r i p t i o n :   P e r f o r m s   a   s p e c i a l i z e d   F e t c h   A P I   c a l l   t o   l o a d   e x t e r n a l   c o n t e n t   i n t o   a   D O M   e l e m e n t . 
 
 
 
 R e t u r n s :   d o m E l e m e n t ,   o r   $ A   o b j e c t   i f   c h a i n e d . 
 
 
 
 N o t e :   T h e   o b j e c t D a t a   s e t t i n g   m a y   b e   u s e d   t o   c u s t o m i z e   t h e   F e t c h   A P I   f u n c t i o n a l i t y ,   a s   d o c u m e n t e d   w i t h i n   " H e l p / $ A   A P I / I m p o r t   a n d   F e t c h   A P I s / G e t " . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   L o a d   c o n t e n t   f r o m   a n   e x t e r n a l   r e s o u r c e   i n t o   a   D O M   e l e m e n t . 
 
 $ A . l o a d ( " p a t h / s r c / r e s o u r c e . h t m l " ,   d o m C o n t a i n e r E l e m e n t ,   { 
 
     s e l e c t o r :   " # c o n t e n t - s e c t i o n "   / /   E x t r a c t s   t h e   e x t e r n a l   e l e m e n t   w i t h   i d = " c o n t e n t - s e c t i o n " 
 
 } ) ; 
 
 
 
 / /   L o a d   c o n t e n t   f r o m   a n   e x t e r n a l   r e s o u r c e   i n t o   a   D O M   e l e m e n t   a n d   e x i c u t e   a   c a l l b a c k   w h e n   c o m p l e t e . 
 
 $ A . l o a d ( " p a t h / s r c / r e s o u r c e . h t m l " ,   d o m C o n t a i n e r E l e m e n t ,   { 
 
     s e l e c t o r :   " # w i d g e t "   / /   E x t r a c t s   t h e   e x t e r n a l   e l e m e n t   w i t h   i d = " w i d g e t " 
 
 } , 
 
 f u n c t i o n ( d o m W i d g e t E l e m e n t )   { 
 
     / /   D o   s o m e t h i n g   w i t h   d o m W i d g e t E l e m e n t 
 
 } ) ; 
 
 
 
 / /   O r   t h e   s a m e   u s i n g   c h a i n i n g 
 
 
 
 / /   L o a d   c o n t e n t   f r o m   a n   e x t e r n a l   r e s o u r c e   i n t o   a   D O M   e l e m e n t . 
 
 v a r   m y C h a i n   =   $ A ( d o m C o n t a i n e r E l e m e n t ) . l o a d ( " p a t h / s r c / r e s o u r c e . h t m l " ,   { 
 
     s e l e c t o r :   " # c o n t e n t - s e c t i o n "   / /   E x t r a c t s   t h e   e x t e r n a l   e l e m e n t   w i t h   i d = " c o n t e n t - s e c t i o n " 
 
 } ) ; 
 
 
 
 / /   L o a d   c o n t e n t   f r o m   a n   e x t e r n a l   r e s o u r c e   i n t o   a   D O M   e l e m e n t   a n d   e x i c u t e   a   c a l l b a c k   w h e n   c o m p l e t e . 
 
 v a r   m y C h a i n   =   $ A ( d o m C o n t a i n e r E l e m e n t ) . l o a d ( " p a t h / s r c / r e s o u r c e . h t m l " ,   { 
 
     s e l e c t o r :   " # w i d g e t "   / /   E x t r a c t s   t h e   e x t e r n a l   e l e m e n t   w i t h   i d = " w i d g e t " 
 
 } , 
 
 f u n c t i o n ( d o m W i d g e t E l e m e n t )   { 
 
     / /   D o   s o m e t h i n g   w i t h   d o m W i d g e t E l e m e n t 
 
 } ) ; 
 
 
 
 / /   T o   r e t u r n   t h e   m o d i f i e d   e l e m e n t   w i t h i n   a   c h a i n ,   u s e   t h e   " r e t u r n ( ) "   m e t h o d . 
 
 
 
 v a r   m y E l e m e n t   =   m y C h a i n . r e t u r n ( ) ; 
 
 